<div id="newevent-modal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <a class="close" data-dismiss="modal">×</a>
                <h3>创建新事件</h3>
            </div>
            <form id="newevent-form" name="newevent" role="form">
                <div class="modal-body">
                    <div class="form-group">
                        <label for="jobnumberid">工作令号</label>
                        <select class="selectpicker form-control" name="jobnumberid" title="选择工作令号"
                            data-show-subtext="true" data-live-search="true">
                            {% for jobnumber in jobnumbers %}
                            <option value="{{ jobnumber[0] }}">{{ jobnumber[1] + '\t' +jobnumber[2]  }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="categoryid">大类</label>
                        <select id="category" class="form-control" name="categoryid" title="选择大类">
                            <option disabled selected value> -- 请选择大类 -- </option>
                            {% for category in categories %}
                            <option value="{{ category[0] }}">{{ category[1] }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="subcategoryid">分类</label>
                        <select id="subcategory" class="form-control" name="subcategoryid" title="选择分类">
                            {#
                        {% for subcategory in subcategories %}
                        <option value="{{ subcategory[0] }}" data-option="{{ subcategory[2] }}">{{ subcategory[1] }}</option>
                        {% endfor %}
                        #}
                            {% for opg,subs in optgroup.items()  %}
                            <optgroup label="{{ opg }}">
                                {% for sub in subs %}
                                <option value={{ sub[0] }}> {{ sub[1] }} </option>
                                {% endfor %}
                            </optgroup>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="tasktime">日期</label>
                        <input id="tasktime" type="text" name="tasktime" class="datepicker form-control">
                    </div>
                    <div class="form-group">
                        <label for="manhour">工时</label>
                        <input id="manhour" type="text" name="manhour" class="form-control"
                            pattern="^[0-9]+\.{0,1}[0-9]{0,5}$" title="数字">
                    </div>
                    <div class="form-group">
                        <label for="title">任务</label>
                        <input id="title" type="text" name="title" maxlength="120" class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="remark">任务备注</label>
                        <textarea name="remark" class="form-control"></textarea>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-success" id="newevent-submit">Create</button>
                </div>
            </form>
        </div>
    </div>
</div>
<div id="editevent-modal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <a class="close" data-dismiss="modal">×</a>
                <h3>修改事件</h3>
            </div>
            <form id="editevent-form" name="newevent" role="form">
                <div class="modal-body">
                    <input type="text" id="taskid" style="display: none;">



                    <div class="form-group">
                        <label for="jobnumberid">工作令号</label>
                        <select id="jobnumber2" class="selectpicker form-control" name="jobnumberid" title="选择工作令号"
                            data-show-subtext="true" data-live-search="true">
                            {% for jobnumber in jobnumbers %}
                            <option value="{{ jobnumber[0] }}">{{ jobnumber[1] +  '\t' + jobnumber[2]}}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="categoryid">大类</label>
                        <select id="category2" class="form-control" name="categoryid" title="选择大类">
                            <option disabled selected value> -- 请选择大类 -- </option>
                            {% for category in categories %}
                            <option value="{{ category[0] }}">{{ category[1] }}</option>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="subcategoryid">分类</label>
                        <select id="subcategory2" class="form-control" name="subcategoryid" title="选择分类">
                            {#
                            {% for subcategory in subcategories %}
                            <option value="{{ subcategory[0] }}" data-option="{{ subcategory[2] }}">{{ subcategory[1] }}</option>
                            {% endfor %}
                            #}
                            {% for opg,subs in optgroup.items()  %}
                            <optgroup label="{{ opg }}">
                                {% for sub in subs %}
                                <option value={{ sub[0] }}> {{ sub[1] }} </option>
                                {% endfor %}
                            </optgroup>
                            {% endfor %}
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="tasktime">日期</label>
                        <input id="tasktime2" type="text" name="tasktime" class="datepicker form-control">
                    </div>
                    <div class="form-group">
                        <label for="manhour">工时</label>
                        <input type="text" id="manhour2" name="manhour" class="form-control"
                            pattern="^[0-9]+\.{0,1}[0-9]{0,5}$" title="数字">
                    </div>
                    <div class="form-group">
                        <label for="title">任务</label>
                        <input type="text" id="title2" name="title" maxlength="120" class="form-control">
                    </div>
                    <div class="form-group">
                        <label for="remark">任务备注</label>
                        <textarea id="remark2" name="remark" class="form-control"></textarea>
                    </div>


                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-danger" id="deleteevent-submit">Delete</button>
                    <button type="button" class="btn btn-success" id="editevent-submit">Modify</button>
                </div>
            </form>
        </div>
    </div>
</div>

<div class="modal fade" role="dialog">
    <select id="subcategory3" class="form-control" name="subcategoryid" title="选择分类">
        {% for opg,subs in optgroup.items()  %}
        <optgroup label="{{ opg }}">
            {% for sub in subs %}
            <option value={{ sub[0] }}> {{ sub[1] }} </option>
            {% endfor %}
        </optgroup>
        {% endfor %}
    </select>
</div>